package com.wanpinghui.wphlibrary.model.product.bean;

import java.util.List;

/***
 * 功能描述:
 * 作者:qiujialiu
 * 时间:2018/1/8
 ***/

public class CartItemBean {

    /**
     * created_at (integer, optional),
     * deleted_at (integer, optional),
     * id (integer, optional): 主键 ,
     * is_consult (boolean, optional): 是否议价 ,
     * main_img (string, optional): 主图 ,
     * min_quantity (integer, optional): 最小起订量 ,
     * name (string, optional): 产品标题 ,
     * price (number, optional): 单价, 无规格时才有值 ,
     * product_desc_id (integer, optional): 产品报价说明id ,
     * product_prices_id (integer, optional): 规格报价id ,
     * quantity (integer, optional): 数量 ,
     * second_name (string, optional): 副标题 ,
     * specItemList (Array[购物车规格清单], optional): 规格清单 ,
     * supplier_id (integer, optional): 代购批发商id ,
     * updated_at (integer, optional),
     * user_id (integer, optional): 购买人id
     */

    private long created_at;
    private long deleted_at;
    private int id;
    private boolean is_consult;
    private String main_img;
    private String name;
    private double price;
    private int product_desc_id;
    private int product_prices_id;
    private int quantity;
    private String second_name;
    private int supplier_id;
    private long updated_at;
    private int user_id;
    private int min_quantity;
    private List<CartItemFormatBean> specItemList;

    private boolean selected;//本地字段，是否选中

    public List<CartItemFormatBean> getSpecItemList() {
        return specItemList;
    }

    public long getCreated_at() {
        return created_at;
    }

    public void setCreated_at(long created_at) {
        this.created_at = created_at;
    }

    public long getDeleted_at() {
        return deleted_at;
    }

    public void setDeleted_at(long deleted_at) {
        this.deleted_at = deleted_at;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public boolean isIs_consult() {
        return is_consult;
    }

    public void setIs_consult(boolean is_consult) {
        this.is_consult = is_consult;
    }

    public String getMain_img() {
        return main_img;
    }

    public void setMain_img(String main_img) {
        this.main_img = main_img;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getProduct_desc_id() {
        return product_desc_id;
    }

    public void setProduct_desc_id(int product_desc_id) {
        this.product_desc_id = product_desc_id;
    }

    public int getProduct_prices_id() {
        return product_prices_id;
    }

    public void setProduct_prices_id(int product_prices_id) {
        this.product_prices_id = product_prices_id;
    }

    public int getMin_quantity() {
        return min_quantity;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public String getSecond_name() {
        return second_name;
    }

    public void setSecond_name(String second_name) {
        this.second_name = second_name;
    }

    public int getSupplier_id() {
        return supplier_id;
    }

    public void setSupplier_id(int supplier_id) {
        this.supplier_id = supplier_id;
    }

    public long getUpdated_at() {
        return updated_at;
    }

    public void setUpdated_at(long updated_at) {
        this.updated_at = updated_at;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public int getAllFormatQuantity() {
        if (getSpecItemList() != null && getSpecItemList().size() >0) {
            int quantity = 0;
            for (CartItemFormatBean formatBean : getSpecItemList()) {
                quantity = quantity + formatBean.getQuantity();
            }
            return quantity;
        }else {
            return quantity;
        }
    }
}
